<div class="main-container">
    <div class="search-wrap">
        <form nz-form [nzLayout]="'inline'" [formGroup]="searchForm">
            <nz-form-item>
                <nz-form-label>隐患级别</nz-form-label>
                <nz-form-control>
                    <input formControlName="level" nz-input placeholder="隐患级别" />
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>隐患分类</nz-form-label>
                <nz-form-control>
                    <input formControlName="type" nz-input placeholder="隐患分类" />
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>隐患状态</nz-form-label>
                <nz-form-control>
                    <input formControlName="statu" nz-input placeholder="隐患状态" />
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>所属工程</nz-form-label>
                <nz-form-control>
                    <input formControlName="project" nz-input placeholder="所属工程" />
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-label>排查时间</nz-form-label>
                <nz-form-control>
                    <nz-range-picker formControlName="rangePickerTime" [nzPlaceHolder]="['起始日期', '结束日期']">
                    </nz-range-picker>
                </nz-form-control>
            </nz-form-item>
            <nz-form-item>
                <nz-form-control>
                    <button nz-button nzType="primary" (click)="queryInfo(true)"><i nz-icon nzType="search"></i>查询
                    </button>
                </nz-form-control>
            </nz-form-item>
        </form>
        <button nz-button nzType="danger" class="add-btn" (click)="openEditModal()">
            <i nz-icon nzType="plus" nzTheme="outline"></i>新增
        </button>
    </div>

    <div class="main-wrap">
        <nz-table #dataTable class="main-table" [nzData]="tableData" [nzTotal]="total" [nzFrontPagination]="false"
            [(nzPageIndex)]="pageNum" [(nzPageSize)]="pageSize" [nzLoading]="loading" (nzPageIndexChange)="queryInfo()"
            nzBordered nzSize="middle">
            <thead>
                <tr>
                    <th>隐患名称</th>
                    <th>隐患级别</th>
                    <th>隐患分类</th>
                    <th>隐患状态</th>
                    <th>所属工程</th>
                    <th>排查日期</th>
                    <th>整改日期</th>
                    <th>整改情况</th>
                    <th>上报单位</th>
                    <th>备注</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr *ngFor="let data of dataTable.data">
                    <td>{{data.name}}</td>
                    <td>{{data.level}}</td>
                    <td>{{data.type}}</td>
                    <td>{{data.statu}}</td>
                    <td>{{data.project}}</td>
                    <td>{{data.investigateDate}}</td>
                    <td>{{data.changeDate}}</td>
                    <td>{{ data.changeStatu }}</td>
                    <td>{{ data.reportDept }}</td>
                    <td>{{data.remark}}</td>
                    <td>
                        <a (click)="openEditModal(false, data)">详情</a>
                        <nz-divider nzType="vertical"></nz-divider>
                        <a (click)="openEditModal(true, data)">编辑</a>
                        <nz-divider nzType="vertical"></nz-divider>
                        <a nz-popconfirm nzPopconfirmTitle="确认删除？" nzPopconfirmPlacement="left"
                            (nzOnConfirm)="onDelete(data.id)">
                            删除
                        </a>
                    </td>
                </tr>
            </tbody>
        </nz-table>
    </div>

    <nz-modal nzClassName="custom-modal sf-education-modal" nzWidth="760" [nzFooter]="queryType"
        [(nzVisible)]="modalShow" [nzTitle]="modalTitle" (nzOnCancel)="onCancel()" (nzOnOk)="onConfirm()">
        <form nz-form [formGroup]="form">
            <div nz-row [nzGutter]="24">
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">隐患名称</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="name" placeholder="隐患名称">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">隐患级别</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="level" placeholder="隐患级别">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">隐患分类</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="type" placeholder="隐患分类">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">隐患状态</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="statu" placeholder="隐患状态">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">所属工程</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="project" placeholder="所属工程">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">排查日期</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <nz-date-picker formControlName="investigateDate" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"
                                nzPlaceHolder="排查日期"></nz-date-picker>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">整改日期</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <nz-date-picker formControlName="changeDate" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss"
                                nzPlaceHolder="整改日期"></nz-date-picker>
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">整改情况</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="changeStatu" placeholder="整改情况">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="12">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="6">上报单位</nz-form-label>
                        <nz-form-control [nzSpan]="16">
                            <input nz-input formControlName="reportDept" placeholder="上报单位">
                        </nz-form-control>
                    </nz-form-item>
                </div>
                <div nz-col [nzSpan]="24">
                    <nz-form-item nzFlex>
                        <nz-form-label [nzSpan]="3">备注</nz-form-label>
                        <nz-form-control [nzSpan]="20">
                            <textarea formControlName="remark" nz-input rows="2"></textarea>
                        </nz-form-control>
                    </nz-form-item>
                </div>

            </div>
        </form>
    </nz-modal>

</div>